using System;
using System.Web.UI;
using MVP.DTO;
using MVP.Presentation;
using MVP.Web.Controls;

public partial class ViewCustomers : Page,IViewCustomerView
{
    private ViewCustomerPresenter presenter;
    
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        presenter = new ViewCustomerPresenter(this);
        this.customerDropDownList.SelectedIndexChanged += delegate
                                                              {
                                                                  presenter.DisplayCustomerDetails();
                                                              };
    }

    protected void Page_Load(object sender, EventArgs e)
    {        
        if (! IsPostBack)
        {
            presenter.Initialize();
        }
    }

    public ILookupList CustomerList
    {
        get { return new WebLookupList(this.customerDropDownList);}
    }

    public string CompanyName
    {
        set { this.companyNameLabel.InnerText = value; }
    }
    public string ContactName
    {
        set { this.contactNameLabel.InnerText = value; }
    }
    public string ContactTitle
    {
        set { this.contactTitleLabel.InnerText = value; }
    }
    public string Address
    {
        set { this.addressLabel.InnerText = value; }
    }
    public string City
    {
        set { this.cityLabel.InnerText = value; }
    }
    public string Region
    {
        set { this.regionLabel.InnerText = value; }
    }
    public string PostalCode
    {
        set { this.postalCodeLabel.InnerText = value; }
    }
    public string Country
    {
        set { this.countryLabel.InnerText = value; }
    }
    public string Phone
    {
        set { this.phoneLabel.InnerText = value; }
    }
    public string Fax
    {
        set { this.faxLabel.InnerText = value; }
    }
}